<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Django + PostgreSQL Test</title>
</head>
<body>
    <h1>从数据库获取的数据：</h1>
    <p id="result">加载中...</p>

    <script>
        fetch('/api/hello/')
            .then(response => response.json())
            .then(data => {
                document.getElementById('result').innerText = data.message;
            })
            .catch(err => {
                document.getElementById('result').innerText = '请求失败: ' + err;
            });
    </script>
</body>
</html>
